'use strict';
let Response = require('../../../model/Response');
let RestifyProxy = require('../../../util/RestifyProxy');
let CustomPageBean = require('../../../model/CustomPageBean');
let systemparaService = require('../../../service/system/systemparaService.js');
let logger = require('../../../util/LoggerUtil').logger('systemparaController.js');

/**
 * 系统设置-系统参数管理—页面
 */
module.exports.systemparaPage = function () {
    let response = new Response();
    response.render('back/system/systempara/systempara');//html路径
    this.resolve(response);
};


/**
 * 系统设置-系统参数管理——列表
 */
module.exports.systemparaList = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await systemparaService.systemparaList(this, params);
        let pageBean = new CustomPageBean(result);
        response.send(pageBean);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};

/*系统参数管理-修改页面-确认按钮*/
module.exports.systemparaCreateSave = async function () {
    let req = this.req;
    let params = req.body;
    let response = new Response();
    try {
        let result = await systemparaService.systemparaCreateSave(this, params);
        response.send(result);
    } catch (error) {
        logger.error(error);
    }
    this.resolve(response);
};


